(library (handlers debug)
  (export debug-handler)
  (import
    (except (rnrs base) let-values error)
    (only (guile) lambda* λ)
    ;; standard web library
    (web response)
    ;; logging
    (prefix (lib logging) log:)
    ;; templates
    (templates debug)
    (templates helpers)
    ;; web helpers
    (lib utils response-utils)))


(define debug-handler
  (lambda (request body)
    "The debug-handler will put all request headers into the
rendered HTML, so that we can see them on the page."
    (log:debug "responding using debug handler")
    (create-html-response
     ;; Inside respond the SXML will be put into a template,
     ;; so there is no need to add html or body tags.
     (debug-table-template request body))))
